package org.naivecoders.ai.functions;

import org.naivecoders.ai.types.MaybeBowl;

public class BiggerThanCondition extends AbstractCondition {

	public BiggerThanCondition(AbstractFunction... inputs) {
		super(inputs);
	}

	@Override
	public MaybeBowl evaluate() {
		if (normalizedSize(getInput(0)) > normalizedSize(getInput(1))) {
			return MaybeBowl.SOMETHING;
		}
		
		return MaybeBowl.NOTHING;
	}

	private int normalizedSize(AbstractFunction f) {
		final MaybeBowl mb = f.evaluate();
		return mb.isNothing() ? -1 : mb.get().getSize();
	}
}
